<template>
  <el-tag :type="type">{{text}}</el-tag>
</template>

<script>
export default {
  name: 'normal-status',
  props: {
    data: {
      type: Object,
      default: () => { }
    }
  },
  computed: {
    type () {
      if (this.isDelete()) {
        return 'danger';
      }
      return this.status === 1 ? 'success' : 'info';
    },
    text () {
      if (this.isDelete()) {
        return '已删除';
      }
      return this.status === 1 ? '显示' : '隐藏';
    },
    status () {
      return this.data.status || -1;
    }
  },
  methods: {
    isDelete () {
      return this.data.deleted_at && this.data.deleted_at != 0;
    }
  }
}
</script>

<style>
</style>